/** 
  *@CopyRight(c)2009 company Co.Ltd. 
  *@All right reserved.
  *@module name: App.FundManage.FundInManage
  *@description:
  *
  *@author: lugj
  *@version: 1.0
  *@date: 2009/06/30
  *@last date: 2009/06/30
  *@history:
    1.
    2.
  *@bugs:
    1. 
    2. 
  *
*/ 

Ext.namespace("App.FundManage.FundInManage");

//FundInManage Class
//config: {id: , }
App.FundManage.FundInManage = function(config){
	this.config = config;
	this.MODULE_ID = App.Base.Common.func.generateGlobalUniqueId(this.config, 'FUNDINMGR');

	this.OpCmd = App.Base.common.param.OP_CMD_NONE;

    /*this.store = new Ext.data.Store({
		id: 'store' + this.MODULE_ID,
        proxy: new Ext.data.HttpProxy({url: App.Base.common.param.TRADESMGR_TRADEDAY_OPERATION_DATAURL}),
        reader: new Ext.data.JsonReader({
            totalProperty: 'totalProperty',
            root: 'root'
        }, [
            {name: 'bargainerId'},
            {name: 'bargainerName'},
            {name: 'amount'},
            {name: 'fundInType'},
            {name: 'payType'},
            {name: 'bankName'},
            {name: 'bankBillCode'},
            {name: 'state'}
        ])
    });*/
    
/*
    this.data = [
        ['bargainerId','bargainerName','amount','fundInType','payType','bankName','bankBillCode','state'],
        ['bargainerId','bargainerName','amount','fundInType','payType','bankName','bankBillCode','state']
    ];
*/
    this.data = [
        ['000818','经销商1','10000','现金','交易中心','银行1','123','记账']
    ];
    this.store = new Ext.data.Store({
        proxy: new Ext.data.MemoryProxy(this.data),
        reader: new Ext.data.ArrayReader({}, [
            {name: 'bargainerId'},
            {name: 'bargainerName'},
            {name: 'amount'},
            {name: 'fundInType'},
            {name: 'payType'},
            {name: 'bankName'},
            {name: 'bankBillCode'},
            {name: 'state'}
        ])
    });
    this.store.load();

	this.sm = new Ext.grid.CheckboxSelectionModel();//{handleMouseDown: Ext.emptyFn}
    this.grid = new Ext.grid.GridPanel({
		id: 'grid' + this.MODULE_ID,
    	border: false,
    	frame: true,
        stripeRows: true,
        loadMask: {msg: '系统正在加载入金数据，请稍候...'},
        autoExpandColumn: 'Friday',
        enableColumnMove: false,
		enableColumnResize: false,
		enableHdMenu: false,
        autoDestroy: true,
        //title: '出入金信息',
		//sm: new Ext.grid.CellSelectionModel(),
		sm: this.sm,
        cm: new Ext.grid.ColumnModel([
			new Ext.grid.RowNumberer(),
            {header: '经销商编码', dataIndex: 'bargainerId', width: 64},
            {header: '经销商名称', dataIndex: 'bargainerName' , width: 64},
            {header: '金额(元)', dataIndex: 'amount' , width: 64},
            {header: '入金方式', dataIndex: 'fundInType' , width: 64},
            {header: '支付方式', dataIndex: 'payType' , width: 64},
            {header: '银行名称', dataIndex: 'bankName' , width: 64},
            {header: '银行票据编码', dataIndex: 'bankBillCode' , width: 64},
            {header: '状态', dataIndex: 'state' , width: 64},
            this.sm
        ]),
        store: this.store,

		bbar: new Ext.PagingToolbar({
			id: 'pagingtbl' + this.MODULE_ID,
            pageSize: App.Base.common.param.GRID_PAGE_SIZE_10,
            store: this.store,
            displayInfo: true,
            displayMsg: '共 {2} 条',//'显示第 {0} 条到 {1} 条记录，共 {2} 条',
            emptyMsg: "没有记录",
            plugins: new Ext.ux.PageSizePlugin()
        }),

        viewConfig: {
            forceFit: true,
            enableRowBody: true,
            getRowClass: function(record, rowIndex, p, ds) {
                var cls = 'white-row';
                switch (rowIndex%2) {
                    case 1:
                        cls = 'red-row'
                        break;
                }
                return cls;
            }
        }
    });

    this.formPanel = new Ext.FormPanel({
		//id: 'formPanel' + this.MODULE_ID,
		autoDestroy: true,
		border: false,
		autoScroll: true,
		frame: true,

		layout: 'border',
		items: [{
			region:'north',
			title : '经销商入金管理',
			height: 178,
			labelAlign: 'right',
			//labelWidth: 80,
			border: false,
			frame: false,
			autoScroll: true,
			split : true,
			collapsible : true,
			bodyStyle:'padding:15px 5px 5px 15px',

			bbar: new Ext.Toolbar({
				border: false,
				items : ['->', '-', {
					text:'<font color="#0000E3">记账</font>',
					iconCls: 'x-menu-personinfolist-add',
					//tooltip: {title:'Tip Title', text:'This is a an example QuickTip for a toolbar item'},
					//enableToggle: true,
					handler: function(){

					},
					scope: this
				}, '-', {
					text:'<font color="#0000E3">审核</font>',
					iconCls: 'x-menu-systemmenusmanage-modify',
					handler: function(){

					},
					scope: this
				}, '-', {
					text:'<font color="#0000E3">撤销</font>',
					iconCls: 'x-menu-personinfolist-delete',
					handler: function(){

					},
					scope: this
				}, '-', {
					text:'<font color="#0000E3">查询</font>',
					iconCls: 'x-button-systemmanage-search',
					handler: function(){

					},
					scope: this
				}, '-', {
					text:'<font color="#0000E3">重置</font>',
					iconCls: 'x-menu-systemmenusmanage-reset',
					handler: function(){

					},
					scope: this
				}, '-'
				]
			}),

			layout: 'form',			
			items :[
				new Ext.Panel({
					layout:'column',
					items: [{
						//columnWidth: .1,
						width: 265,
						anchor:'95%',
						layout: 'form',
						items:[{
								xtype: 'textfield',
								fieldLabel: '<font color="#FF0000">经销商编码</font>',
								maskRe: eval(App.Base.common.param.TEXTFIELD_INPUT_MASKRE),
								regex: eval(App.Base.common.param.TEXTFIELD_INPUT_REGEX),
								regexText: App.Base.common.param.TEXTFIELD_INPUT_REGEX_TIPS
							}
						]
					},{
						width: 98,
						anchor:'95%',
						items: [
							new Ext.Button({
								text: '<font color="blue">查询名称</font>',
								iconCls: 'x-button-systemmanage-search',
								handler: function(){
									

								},
								scope: this
							})	
						]
					}, {
						width: 320,
						layout: 'form',
						anchor:'95%',
						items:[{
								xtype: 'textfield',
								width: 200,
								fieldLabel: '<font color="#FF0000">经销商名称</font>',
								maskRe: eval(App.Base.common.param.TEXTFIELD_INPUT_MASKRE),
								regex: eval(App.Base.common.param.TEXTFIELD_INPUT_REGEX),
								regexText: App.Base.common.param.TEXTFIELD_INPUT_REGEX_TIPS
							}
						]
					}]
				}),
				new Ext.Panel({
					layout:'column',
					items: [{
						width: 260,
						anchor:'95%',
						layout: 'form',
						items:[
							new Ext.form.ComboBox({
								id: 'fundInType' + this.MODULE_ID,
								fieldLabel: '<font color="red">入金方式</font>',
								width : 80,
								store: new Ext.data.SimpleStore({
									fields: ['value', 'text'],
									data: [
										['0', '现金'],
										['1', '支票'],
										['2', '网银'],
										['3', '其他']
									]
								}),
								value: 0,	
								mode: 'local',
								editable: false,
								allowBlank: false,
								triggerAction: 'all',
								valueField: 'value',
								displayField: 'text'
							})
						]
					},{
						width: 280,
						layout: 'form',
						anchor:'95%',
						items:[
							new Ext.form.ComboBox({
								id: 'payType' + this.MODULE_ID,
								fieldLabel: '<font color="red">支付方式</font>',
								width : 80,
								store: new Ext.data.SimpleStore({
									fields: ['value', 'text'],
									data: [
										['0', '银行'],
										['1', '交易中心'],
										['2', '其他']
									]
								}),
								value: 0,	
								mode: 'local',
								editable: false,
								allowBlank: false,
								triggerAction: 'all',
								valueField: 'value',
								displayField: 'text'
							})
						]
					}]
				}),
				new Ext.Panel({
					layout:'column',
					items: [{
						width: 260,
						anchor:'95%',
						layout: 'form',
						items:[{
								xtype: 'textfield',
								fieldLabel: '<font color="#FF0000">金额</font>',
								maskRe: eval(App.Base.common.param.TEXTFIELD_INPUT_MASKRE),
								regex: eval(App.Base.common.param.TEXTFIELD_INPUT_REGEX),
								regexText: App.Base.common.param.TEXTFIELD_INPUT_REGEX_TIPS
							}
						]
					},{
						width: 280,
						layout: 'form',
						anchor:'95%',
						items:[{
								xtype: 'textfield',
								width: 170,
								fieldLabel: '<font color="#FF0000">票据银行名称</font>',
								maskRe: eval(App.Base.common.param.TEXTFIELD_INPUT_MASKRE),
								regex: eval(App.Base.common.param.TEXTFIELD_INPUT_REGEX),
								regexText: App.Base.common.param.TEXTFIELD_INPUT_REGEX_TIPS
							}
						]
					},{
						width: 320,
						layout: 'form',
						anchor:'95%',
						items:[{
								xtype: 'textfield',
								fieldLabel: '<font color="#FF0000">票据编号</font>',
								maskRe: eval(App.Base.common.param.TEXTFIELD_INPUT_MASKRE),
								regex: eval(App.Base.common.param.TEXTFIELD_INPUT_REGEX),
								regexText: App.Base.common.param.TEXTFIELD_INPUT_REGEX_TIPS
							}
						]
					}]
				})
			]	
		},{
			region:'center',
			border: false,
			autoScroll: true,
			bodyStyle:'padding:5px 5px 5px 0',

			
			layout: 'fit',
			items: [this.grid]		
		}]

	});

	this.formPanel.doLayout();

	//defined methods.
    if((typeof App.FundManage.FundInManage.SIMULATE_SHARED_METHODS_FLAG) == "undefined")
    {
        App.FundManage.FundInManage.SIMULATE_SHARED_METHODS_FLAG = true;   

        App.FundManage.FundInManage.prototype.getMainPanel = function(){   
            return this.formPanel;  
        };
 
        //simulating the class's constructor().
        var __ctor = function(){
            //alert('called __constructor() ok.');
        }();

    }
}